import { Toast } from "antd-mobile";
import request from "@/api/request";

/**
 * 获取亮码
 * @param {Object} params - 查询参数
 * @returns {Promise} 返回数据
 */
export const getQrCode = async (data = {}) => {
  Toast.show({
    icon: "loading",
    maskClickable: false,
  });
  const ret = await request({
    url: "/member/getQrCode",
    method: "post",
    data,
  });
  Toast.clear();
  return ret;
};

/**
 * 模拟扫码枪
 * @param {Object} params - 查询参数
 * @returns {Promise} 返回数据
 */
export const unionayQrExtProcessMember = async (data = {}) => {
  Toast.show({
    icon: "loading",
    maskClickable: false,
  });
  const ret = await request({
    url: "/callback/api/v1/unionayQrExtProcessMember",
    method: "post",
    data,
  });
  Toast.clear();
  return ret;
};
/**
 * 确认订单
 * @param {Object} params - 查询参数
 * @returns {Promise} 返回数据
 */
export const memberPay = async (data = {}) => {
  Toast.show({
    icon: "loading",
    maskClickable: false,
  });
  const ret = await request({
    url: "/member/pay",
    method: "post",
    data,
  });
  Toast.clear();
  return ret;
};

/**
 * 金豆
 * @param {Object} params - 查询参数
 * @returns {Promise} 返回数据
 */
export const getPoint = async (data = {}) => {
  Toast.show({
    icon: "loading",
    maskClickable: false,
  });
  const ret = await request({
    url: "/member/getPoint",
    method: "post",
    data,
  });
  Toast.clear();
  return ret;
};

/**
 * 剩余
 * @param {Object} params - 查询参数
 * @returns {Promise} 返回数据
 */
export const savingMoney = async (data = {}) => {
  const ret = await request({
    url: "/member/savingMoney",
    method: "post",
    data,
  });
  return ret;
};

/**
 * 剩余
 * @param {Object} params - 查询参数
 * @returns {Promise} 返回数据
 */
export const savingMoneyOrderList = async (data = {}) => {
  const ret = await request({
    url: "/member/savingMoneyOrderList",
    method: "post",
    data,
  });
  return ret;
};
